package com.ashin;

/**
 * @Author: Ashin
 * @Date: 2020/12/1
 * @Description: com.ashin
 * @Version: 1.0.0
 */
public class Hailstone {

    public static void main(String[] args) {
        int hailstone = hailstone(27);
        System.out.print(hailstone);
    }

    /**
     * 求个数
     * @param n
     * @return
     */
    private static int hailstone(int n) {
        int len = 1;

        while (n > 1) {
            n = (n % 2 == 0 ? n / 2 : (3 * n + 1));

            len++;
        }

        return len;
    }
}
